import request from '@/utils/request'

// 查询用户信息列表
export function listsysUser(query) {
    return request({
        url: '/system/agent/list',
        method: 'get',
        params: query
    })
}



// 查询用户信息详细
export function getsysUser(userId) {
    return request({
        url: '/system/agent/' + userId,
        method: 'get'
    })
}

// 新增用户信息
export function addsysUser(data) {
    return request({
        url: '/system/agent',
        method: 'post',
        data: data
    })
}

// 修改用户信息
export function updatesysUser(data) {
    return request({
        url: '/system/agent',
        method: 'put',
        data: data
    })
}

// 删除用户信息
export function delsysUser(userId) {
    return request({
        url: '/system/agent/' + userId,
        method: 'delete'
    })
}

// 导出用户信息
export function exportsysUser(query) {
    return request({
        url: '/system/agent/export',
        method: 'get',
        params: query
    })
}

// 重置密码

export function resetPwd(userId) {
    return request({
        url: `/system/agent/resetPwd/${userId}`,
        method: 'post'
    })
}


// API密钥
export function getApiKey(userId) {
    return request({
        url: `/system/agent/getApiKey/${userId}`,
        method: 'get'
    })
}

// /createApiKey/{userId} 创建密钥
// /resetApiKey/{userId} 重置密钥


// 创建密钥
export function createApiKey(userId) {
    return request({
        url: `/system/agent/createApiKey/${userId}`,
        method: 'post'
    })
}

// 重置密钥
export function resetApiKey(userId) {
    return request({
        url: `/system/agent/resetApiKey/${userId}`,
        method: 'post'
    })
}

// /createSheare/{userId} 创建分润
// /getSheare/{userId} 获取分润
// /updateSheare/{userId} 修改分润

// 创建分润

export function createSheare(userId, data) {
    return request({
        url: `/system/agent/createSheare/${userId}`,
        method: 'post',
        data: data
    })
}

// 获取分润

export function getSheare(userId) {
    return request({
        url: `/system/agent/getSheare/${userId}`,
        method: 'get'
    })
}

// 修改分润

export function updateSheare(userId, data) {
    return request({
        url: `/system/agent/updateSheare/${userId}`,
        method: 'post',
        data: data
    })
}

export function agentResetPwd(userId, data) {
    return request({
        url: `/system/agent/resetPwd/${userId}`,
        method: 'post',
        data: data
    })
}

export function getInfoByUserId(id) {
    return request({
        url: `/enterprise/enterpriseInfo/getInfoByUserId/${id}`,
        method: 'get'
    })
}

